The algorithm for validating the two check digits of a reference number is as follows:
First Check Digit:
The first of the two check digits is calculated as:
MOD 10 [10 - MOD 10 (Y)]
where Y is the sum of the products obtained by multiplying the 3rd to the 10th digits of the reference number by the following weights:
|
Digit |
Weight |
|
3 |
9 |
|
4 |
7 |
|
5 |
8 |
|
6 |
6 |
|
7 |
7 |
|
8 |
9 |
|
9 |
6 |
|
10 |
8 |
Second Check Digit:
The second check digit is calculated as:
MOD 10 [10 - MOD 10 (Z)]
where Z is the sum of the following:
f(digit 1) + digit 2 + f(digit 3) + digit 4 +f(digit 5)
+ digit 6 + f(digit 7) + digit 8 +
f(digit 9) + digit 10 + f(first check digit)
The value of f(digit n) is determined as follows:
|
Digit |
f(digit n) |
|
0 |
0 |
|
1 |
2 |
|
2 |
4 |
|
3 |
6 |
|
4 |
8 |
|
5 |
1 |
|
6 |
3 |
|
7 |
5 |
|
8 |
7 |
|
9 |
9 |
The MOD 10 (n) operation yields a value that is the remainder after dividing n by 10. This remainder is the same as the low-order digit on n.
Example:
The following example illustrates the validation of the reference number 936125183702, where 0 is the first check digit and 2 is the second check digit.
|
|
|
9 |
3 |
6 |
1 |
2 |
5 |
1 |
8 |
3 |
7 |
0 |
2 |
